

#include "socket/socket.h"

#include <iostream>

int main(int argc, char* argv[])
{
    (void)argc;
    (void)argv;

    std::cout<<"WELCOME TO SIMPLE CLIENT\n";

    try
    {
        std::cout<<"CLIENT: STARTED\n";

        net::Init();
        net::Channel channel;

        channel.Connect("127.0.0.1", 333);
        channel << "hello";

        for( ;; )
        {
            std::string data;
            
            channel  >> data;
            std::cout<<"from server: " << data << std::endl;

            if(data == "exit")
                break;

            std::cin >> data;
            channel << data;
        }
        
        net::Shutdown();
    }
    catch (std::exception& e)
    {
        std::cout<< e.what()<<std::endl;
    }

    std::cout<<"CLIENT: FINISHED\n";
}

